
<!DOCTYPE html>

<html>
  
<!-- Mirrored from docs.sympy.org/latest/modules/polys/ringseries.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:29:05 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

    <title>Series Manipulation using Polynomials &#8212; SymPy 1.9 documentation</title>
    <link rel="stylesheet" type="text/css" href="../../_static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/default.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/graphviz.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/plot_directive.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-core.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-autocomplete.css" />
    <link rel="stylesheet" type="text/css" href="../../../../live.sympy.org/static/live-sphinx.css" />
    
    <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../../../live.sympy.org/static/utilities.js"></script>
    <script src="../../../../live.sympy.org/static/external/classy.js"></script>
    <script src="../../../../live.sympy.org/static/live-core.js"></script>
    <script src="../../../../live.sympy.org/static/live-autocomplete.js"></script>
    <script src="../../../../live.sympy.org/static/live-sphinx.js"></script>
    <script async="async" src="../../../../cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest8331.js?config=TeX-AMS_HTML-full"></script>
    <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]]}})</script>
    
    <link rel="shortcut icon" href="../../_static/sympy-notailtext-favicon.ico"/>
    <link href="ringseries.html" rel="canonical" />
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Literature" href="literature.html" />
    <link rel="prev" title="Internals of the Polynomial Manipulation Module" href="internals.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="literature.html" title="Literature"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="internals.html" title="Internals of the Polynomial Manipulation Module"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Polynomial Manipulation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Series Manipulation using Polynomials</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="series-manipulation-using-polynomials">
<span id="polys-ringseries"></span><h1>Series Manipulation using Polynomials<a class="headerlink" href="#series-manipulation-using-polynomials" title="Permalink to this headline">¶</a></h1>
<p>Any finite Taylor series, for all practical purposes is, in fact a polynomial.
This module makes use of the efficient representation and operations of sparse
polynomials for very fast multivariate series manipulations. Typical speedups
compared to SymPy’s <code class="docutils literal notranslate"><span class="pre">series</span></code> method are in the range 20-100, with the gap
widening as the series being handled gets larger.</p>
<p>All the functions expand any given series on some ring specified by the user.
Thus, the coefficients of the calculated series depend on the ring being used.
For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys</span> <span class="kn">import</span> <span class="n">ring</span><span class="p">,</span> <span class="n">QQ</span><span class="p">,</span> <span class="n">RR</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_sin</span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="go">-1/6*x**3*y**3 + x*y</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">QQ</span></code> stands for the Rational domain. Here all coefficients are rationals. It
is recommended to use <code class="docutils literal notranslate"><span class="pre">QQ</span></code> with ring series as it automatically chooses the
fastest Rational type.</p>
<p>Similarly, if a Real domain is used:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">RR</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_sin</span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="go">-0.166666666666667*x**3*y**3 + x*y</span>
</pre></div>
</div>
<p>Though the definition of a polynomial limits the use of Polynomial module to
Taylor series, we extend it to allow Laurent and even Puiseux series (with
fractional exponents):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_cos</span><span class="p">,</span> <span class="n">rs_tan</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_cos</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">/</span><span class="n">x</span><span class="o">**</span><span class="mi">3</span>
<span class="go">-1/2*x**(-1)*y**2 - x**(-1)*y - 1/2*x**(-1) + x**(-3)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_tan</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span><span class="o">*</span><span class="n">y</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="go">1/3*x**(6/5)*y**(3/2) + x**(2/5)*y**(1/2)</span>
</pre></div>
</div>
<p>By default, <code class="docutils literal notranslate"><span class="pre">PolyElement</span></code> did not allow non-natural numbers as exponents. It
converted a fraction to an integer and raised an error on getting negative
exponents. The goal of the <code class="docutils literal notranslate"><span class="pre">ring</span> <span class="pre">series</span></code> module is fast series expansion, and
not to use the <code class="docutils literal notranslate"><span class="pre">polys</span></code> module. The reason we use it as our backend is simply
because it implements a sparse representation and most of the basic functions
that we need. However, this default behaviour of <code class="docutils literal notranslate"><span class="pre">polys</span></code> was limiting for
<code class="docutils literal notranslate"><span class="pre">ring</span> <span class="pre">series</span></code>.</p>
<p>Note that there is no such constraint (in having rational exponents) in the
data-structure used by <code class="docutils literal notranslate"><span class="pre">polys</span></code>- <code class="docutils literal notranslate"><span class="pre">dict</span></code>. Sparse polynomials
(<code class="docutils literal notranslate"><span class="pre">PolyElement</span></code>) use the Python dict to store a polynomial term by term, where
a tuple of exponents is the key and the coefficient of that term is the value.
There is no reason why we can’t have rational values in the <code class="docutils literal notranslate"><span class="pre">dict</span></code> so as to
support rational exponents.</p>
<p>So the approach we took was to modify sparse <code class="docutils literal notranslate"><span class="pre">polys</span></code> to allow non-natural
exponents. And it turned out to be quite simple. We only had to delete the
conversion to <code class="docutils literal notranslate"><span class="pre">int</span></code> of exponents in the <code class="docutils literal notranslate"><span class="pre">__pow__</span></code> method of
<code class="docutils literal notranslate"><span class="pre">PolyElement</span></code>. So:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">x**(3/4)</span>
</pre></div>
</div>
<p>and not <code class="docutils literal notranslate"><span class="pre">1</span></code> as was the case earlier.</p>
<p>Though this change violates the definition of a polynomial, it doesn’t break
anything yet.  Ideally, we shouldn’t modify <code class="docutils literal notranslate"><span class="pre">polys</span></code> in any way. But to have
all the <code class="docutils literal notranslate"><span class="pre">series</span></code> capabilities we want, no other simple way was found. If need
be, we can separate the modified part of <code class="docutils literal notranslate"><span class="pre">polys</span></code> from core <code class="docutils literal notranslate"><span class="pre">polys</span></code>. It
would be great if any other elegant solution is found.</p>
<p>All series returned by the functions of this module are instances of the
<code class="docutils literal notranslate"><span class="pre">PolyElement</span></code> class. To use them with other SymPy types, convert them  to
<code class="docutils literal notranslate"><span class="pre">Expr</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_exp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.abc</span> <span class="kn">import</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">,</span> <span class="n">c</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">series</span> <span class="o">=</span> <span class="n">rs_exp</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">+</span> <span class="n">series</span><span class="o">.</span><span class="n">as_expr</span><span class="p">()</span>
<span class="go">a + x**4/24 + x**3/6 + x**2/2 + x + 1</span>
</pre></div>
</div>
<section id="rs-series">
<h2>rs_series<a class="headerlink" href="#rs-series" title="Permalink to this headline">¶</a></h2>
<p>Direct use of elementary ring series functions does give more control, but is
limiting at the same time. Creating an appropriate ring for the desired series
expansion and knowing which ring series function to call, are things not
everyone might be familiar with.</p>
<p><span class="math notranslate nohighlight">\(rs\_series\)</span> is a function that takes an arbitrary <code class="docutils literal notranslate"><span class="pre">Expr</span></code> and returns its
expansion by calling the appropriate ring series functions. The returned series
is a polynomial over the simplest (almost) possible ring that does the job. It
recursively builds the ring as it parses the given expression, adding
generators to the ring when it needs them. Some examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">rs_series</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">b</span><span class="p">),</span> <span class="n">a</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span> 
<span class="go">1/24*sin(b)*a**4 - 1/2*sin(b)*a**2 + sin(b) - 1/6*cos(b)*a**3 + cos(b)*a</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_series</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">exp</span><span class="p">(</span><span class="n">a</span><span class="o">*</span><span class="n">b</span><span class="p">)</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">c</span><span class="p">)),</span> <span class="n">a</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> 
<span class="go">-sin(c)*cos(cos(c) + 1)*a + cos(cos(c) + 1)*a*b + sin(cos(c) + 1)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_series</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">b</span><span class="p">)</span><span class="o">*</span><span class="n">cos</span><span class="p">(</span><span class="n">a</span> <span class="o">+</span> <span class="n">c</span><span class="p">)</span><span class="o">*</span><span class="n">tan</span><span class="p">(</span><span class="n">a</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">b</span><span class="p">),</span> <span class="n">a</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> 
<span class="go">cos(b)*cos(c)*tan(b)*a - sin(b)*sin(c)*tan(b)*a + sin(b)*cos(c)*tan(b)</span>
</pre></div>
</div>
<p>It can expand complicated multivariate expressions involving multiple functions
and most importantly, it does so blazingly fast:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="o">%</span><span class="n">timeit</span> <span class="p">((</span><span class="n">sin</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="n">a</span><span class="p">))</span><span class="o">**</span><span class="mi">10</span><span class="p">)</span><span class="o">.</span><span class="n">series</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span> 
<span class="go">1 loops, best of 3: 1.33 s per loop</span>

<span class="gp">&gt;&gt;&gt; </span><span class="o">%</span><span class="n">timeit</span> <span class="n">rs_series</span><span class="p">((</span><span class="n">sin</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="n">a</span><span class="p">))</span><span class="o">**</span><span class="mi">10</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span> 
<span class="go">100 loops, best of 3: 4.13 ms per loop</span>
</pre></div>
</div>
<p><span class="math notranslate nohighlight">\(rs\_series\)</span> is over 300 times faster. Given an expression to expand, there is
some fixed overhead to parse it. Thus, for larger orders, the speed
improvement becomes more prominent:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="o">%</span><span class="n">timeit</span> <span class="n">rs_series</span><span class="p">((</span><span class="n">sin</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="o">+</span> <span class="n">cos</span><span class="p">(</span><span class="n">a</span><span class="p">))</span><span class="o">**</span><span class="mi">10</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span> 
<span class="go">10 loops, best of 3: 32.8 ms per loop</span>
</pre></div>
</div>
<p>To figure out the right ring for a given expression, <span class="math notranslate nohighlight">\(rs\_series\)</span> uses the
<code class="docutils literal notranslate"><span class="pre">sring</span></code> function, which in turn uses other functions of <code class="docutils literal notranslate"><span class="pre">polys</span></code>. As
explained above, non-natural exponents are not allowed. But the restriction is
on exponents and not generators. So, <code class="docutils literal notranslate"><span class="pre">polys</span></code> allows all sorts of symbolic
terms as generators to make sure that the exponent is a natural number:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">sring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">expr</span> <span class="o">=</span> <span class="n">sring</span><span class="p">(</span><span class="mi">1</span><span class="o">/</span><span class="n">a</span><span class="o">**</span><span class="mi">3</span> <span class="o">+</span> <span class="n">a</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">));</span> <span class="n">R</span>
<span class="go">Polynomial ring in 1/a, a**(1/7) over ZZ with lex order</span>
</pre></div>
</div>
<p>In the above example, <span class="math notranslate nohighlight">\(1/a\)</span> and <span class="math notranslate nohighlight">\(a**(1/7)\)</span> will be treated as completely
different atoms. For all practical purposes, we could let <span class="math notranslate nohighlight">\(b = 1/a\)</span> and <span class="math notranslate nohighlight">\(c =
a**(1/7)\)</span> and do the manipulations. Effectively, expressions involving <span class="math notranslate nohighlight">\(1/a\)</span>
and <span class="math notranslate nohighlight">\(a**(1/7)\)</span> (and their powers) will never simplify:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">expr</span><span class="o">*</span><span class="n">R</span><span class="p">(</span><span class="mi">1</span><span class="o">/</span><span class="n">a</span><span class="p">)</span> 
<span class="go">(1/a)**2 + (1/a)*(a**(1/7))**3</span>
</pre></div>
</div>
<p>This leads to similar issues with manipulating Laurent and Puiseux series as
faced earlier. Fortunately, this time we have an elegant solution and are able
to isolate the <code class="docutils literal notranslate"><span class="pre">series</span></code> and <code class="docutils literal notranslate"><span class="pre">polys</span></code> behaviour from one another. We
introduce a boolean flag <code class="docutils literal notranslate"><span class="pre">series</span></code> in the list of allowed <code class="docutils literal notranslate"><span class="pre">Options</span></code> for
polynomials (see <a class="reference internal" href="internals.html#sympy.polys.polyoptions.Options" title="sympy.polys.polyoptions.Options"><code class="xref py py-class docutils literal notranslate"><span class="pre">sympy.polys.polyoptions.Options</span></code></a>). Thus, when we want
<code class="docutils literal notranslate"><span class="pre">sring</span></code> to allow rational exponents we supply a <code class="docutils literal notranslate"><span class="pre">series=True</span></code> flag to
<code class="docutils literal notranslate"><span class="pre">sring</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">rs_series</span><span class="p">(</span><span class="n">sin</span><span class="p">(</span><span class="n">a</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)),</span> <span class="n">a</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> 
<span class="go">-1/5040*a**(7/3) + 1/120*a**(5/3) - 1/6*a + a**(1/3)</span>
</pre></div>
</div>
</section>
<section id="contribute">
<h2>Contribute<a class="headerlink" href="#contribute" title="Permalink to this headline">¶</a></h2>
<p><span class="math notranslate nohighlight">\(rs\_series\)</span> is not fully implemented yet. As of now, it supports only
multivariate Taylor expansions of expressions involving <code class="docutils literal notranslate"><span class="pre">sin</span></code>, <code class="docutils literal notranslate"><span class="pre">cos</span></code>,
<code class="docutils literal notranslate"><span class="pre">exp</span></code> and <code class="docutils literal notranslate"><span class="pre">tan</span></code>. Adding the remaining functions is not at all difficult and
they will be gradually added. If you are interested in helping, read the
comments in <code class="docutils literal notranslate"><span class="pre">ring_series.py</span></code>. Currently, it does not support Puiseux series
(though the elementary functions do). This is expected to be fixed soon.</p>
<p>You can also add more functions to <code class="docutils literal notranslate"><span class="pre">ring_series.py</span></code>. Only elementary
functions are supported currently. The long term goal is to replace SymPy’s
current <code class="docutils literal notranslate"><span class="pre">series</span></code> method with <code class="docutils literal notranslate"><span class="pre">rs_series</span></code>.</p>
<section id="manipulation-of-power-series">
<h3>Manipulation of power series<a class="headerlink" href="#manipulation-of-power-series" title="Permalink to this headline">¶</a></h3>
<p>Functions in this module carry the prefix <code class="docutils literal notranslate"><span class="pre">rs_</span></code>, standing for “ring series”.
They manipulate finite power series in the sparse representation provided
by <code class="docutils literal notranslate"><span class="pre">polys.ring.ring</span></code>.</p>
<p><strong>Elementary functions</strong></p>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_log">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_log</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1000-L1055"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_log" title="Permalink to this definition">¶</a></dt>
<dd><p>The Logarithm of <code class="docutils literal notranslate"><span class="pre">p</span></code> modulo <code class="docutils literal notranslate"><span class="pre">O(x**prec)</span></code>.</p>
<p class="rubric">Notes</p>
<p>Truncation of <code class="docutils literal notranslate"><span class="pre">integral</span> <span class="pre">dx</span> <span class="pre">p**-1*d</span> <span class="pre">p/dx</span></code> is used.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_log</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_log</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>
<span class="go">1/7*x**7 - 1/6*x**6 + 1/5*x**5 - 1/4*x**4 + 1/3*x**3 - 1/2*x**2 + x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_log</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="go">1/3*x**(9/2) - 1/2*x**3 + x**(3/2)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_LambertW">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_LambertW</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1057-L1094"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_LambertW" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the series expansion of the principal branch of the Lambert W
function.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_LambertW</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_LambertW</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">-x**2*y**2 - 2*x**2*y - x**2 + x*y + x</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.exponential.LambertW" title="sympy.functions.elementary.exponential.LambertW"><code class="xref py py-obj docutils literal notranslate"><span class="pre">LambertW</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_exp">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_exp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1106-L1161"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_exp" title="Permalink to this definition">¶</a></dt>
<dd><p>Exponentiation of a series modulo <code class="docutils literal notranslate"><span class="pre">O(x**prec)</span></code></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_exp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_exp</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">7</span><span class="p">)</span>
<span class="go">1/6*x**6 + 1/2*x**4 + x**2 + 1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_atan">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_atan</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1179-L1231"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_atan" title="Permalink to this definition">¶</a></dt>
<dd><p>The arctangent of a series</p>
<p>Return the series expansion of the atan of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_atan</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_atan</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">-1/3*x**3*y**3 - x**3*y**2 - x**3*y - 1/3*x**3 + x*y + x</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.trigonometric.atan" title="sympy.functions.elementary.trigonometric.atan"><code class="xref py py-obj docutils literal notranslate"><span class="pre">atan</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_asin">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_asin</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1233-L1276"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_asin" title="Permalink to this definition">¶</a></dt>
<dd><p>Arcsine of a series</p>
<p>Return the series expansion of the asin of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_asin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_asin</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>
<span class="go">5/112*x**7 + 3/40*x**5 + 1/6*x**3 + x</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.trigonometric.asin" title="sympy.functions.elementary.trigonometric.asin"><code class="xref py py-obj docutils literal notranslate"><span class="pre">asin</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_tan">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_tan</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1299-L1357"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_tan" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>Tangent of a series.</p>
<p>Return the series expansion of the tan of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
</div></blockquote>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_tan</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_tan</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">1/3*x**3*y**3 + x**3*y**2 + x**3*y + 1/3*x**3 + x*y + x</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#sympy.polys.ring_series._tan1" title="sympy.polys.ring_series._tan1"><code class="xref py py-obj docutils literal notranslate"><span class="pre">_tan1</span></code></a>, <a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.trigonometric.tan" title="sympy.functions.elementary.trigonometric.tan"><code class="xref py py-obj docutils literal notranslate"><span class="pre">tan</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series._tan1">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">_tan1</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1278-L1297"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series._tan1" title="Permalink to this definition">¶</a></dt>
<dd><p>Helper function of <a class="reference internal" href="#sympy.polys.ring_series.rs_tan" title="sympy.polys.ring_series.rs_tan"><code class="xref py py-func docutils literal notranslate"><span class="pre">rs_tan()</span></code></a>.</p>
<p>Return the series expansion of tan of a univariate series using Newton’s
method. It takes advantage of the fact that series expansion of atan is
easier than that of tan.</p>
<p>Consider <span class="math notranslate nohighlight">\(f(x) = y - \arctan(x)\)</span>
Let r be a root of f(x) found using Newton’s method.
Then <span class="math notranslate nohighlight">\(f(r) = 0\)</span>
Or <span class="math notranslate nohighlight">\(y = \arctan(x)\)</span> where <span class="math notranslate nohighlight">\(x = \tan(y)\)</span> as required.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_cot">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_cot</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1359-L1393"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_cot" title="Permalink to this definition">¶</a></dt>
<dd><p>Cotangent of a series</p>
<p>Return the series expansion of the cot of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_cot</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_cot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span>
<span class="go">-2/945*x**5 - 1/45*x**3 - 1/3*x + x**(-1)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.trigonometric.cot" title="sympy.functions.elementary.trigonometric.cot"><code class="xref py py-obj docutils literal notranslate"><span class="pre">cot</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_sin">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_sin</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1395-L1463"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_sin" title="Permalink to this definition">¶</a></dt>
<dd><p>Sine of a series</p>
<p>Return the series expansion of the sin of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_sin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_sin</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">-1/6*x**3*y**3 - 1/2*x**3*y**2 - 1/2*x**3*y - 1/6*x**3 + x*y + x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_sin</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">-1/2*x**(7/2)*y**(14/5) - 1/6*x**3*y**(21/5) + x**(3/2) + x*y**(7/5)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.trigonometric.sin" title="sympy.functions.elementary.trigonometric.sin"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sin</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_cos">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_cos</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1465-L1536"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_cos" title="Permalink to this definition">¶</a></dt>
<dd><p>Cosine of a series</p>
<p>Return the series expansion of the cos of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_cos</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_cos</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">-1/2*x**2*y**2 - x**2*y - 1/2*x**2 + 1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_cos</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span><span class="o">/</span><span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="go">-1/2*x**(3/5)*y**2 - x**(3/5)*y - 1/2*x**(3/5) + x**(-7/5)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.trigonometric.cos" title="sympy.functions.elementary.trigonometric.cos"><code class="xref py py-obj docutils literal notranslate"><span class="pre">cos</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_cos_sin">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_cos_sin</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1538-L1549"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_cos_sin" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the tuple <code class="docutils literal notranslate"><span class="pre">(rs_cos(p,</span> <span class="pre">x,</span> <span class="pre">prec)`,</span> <span class="pre">`rs_sin(p,</span> <span class="pre">x,</span> <span class="pre">prec))</span></code>.</p>
<p>Is faster than calling rs_cos and rs_sin separately</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_atanh">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_atanh</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1567-L1619"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_atanh" title="Permalink to this definition">¶</a></dt>
<dd><p>Hyperbolic arctangent of a series</p>
<p>Return the series expansion of the atanh of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_atanh</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_atanh</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">1/3*x**3*y**3 + x**3*y**2 + x**3*y + 1/3*x**3 + x*y + x</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.hyperbolic.atanh" title="sympy.functions.elementary.hyperbolic.atanh"><code class="xref py py-obj docutils literal notranslate"><span class="pre">atanh</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_sinh">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_sinh</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1621-L1646"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_sinh" title="Permalink to this definition">¶</a></dt>
<dd><p>Hyperbolic sine of a series</p>
<p>Return the series expansion of the sinh of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_sinh</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_sinh</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">1/6*x**3*y**3 + 1/2*x**3*y**2 + 1/2*x**3*y + 1/6*x**3 + x*y + x</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.hyperbolic.sinh" title="sympy.functions.elementary.hyperbolic.sinh"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sinh</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_cosh">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_cosh</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1648-L1673"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_cosh" title="Permalink to this definition">¶</a></dt>
<dd><p>Hyperbolic cosine of a series</p>
<p>Return the series expansion of the cosh of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_cosh</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_cosh</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">1/2*x**2*y**2 + x**2*y + 1/2*x**2 + 1</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.hyperbolic.cosh" title="sympy.functions.elementary.hyperbolic.cosh"><code class="xref py py-obj docutils literal notranslate"><span class="pre">cosh</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_tanh">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_tanh</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1696-L1748"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_tanh" title="Permalink to this definition">¶</a></dt>
<dd><p>Hyperbolic tangent of a series</p>
<p>Return the series expansion of the tanh of <code class="docutils literal notranslate"><span class="pre">p</span></code>, about 0.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_tanh</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_tanh</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">-1/3*x**3*y**3 - x**3*y**2 - x**3*y - 1/3*x**3 + x*y + x</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="../functions/elementary.html#sympy.functions.elementary.hyperbolic.tanh" title="sympy.functions.elementary.hyperbolic.tanh"><code class="xref py py-obj docutils literal notranslate"><span class="pre">tanh</span></code></a></p>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_hadamard_exp">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_hadamard_exp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inverse</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1772-L1800"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_hadamard_exp" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">sum</span> <span class="pre">f_i/i!*x**i</span></code> from <code class="docutils literal notranslate"><span class="pre">sum</span> <span class="pre">f_i*x**i</span></code>,
where <code class="docutils literal notranslate"><span class="pre">x</span></code> is the first variable.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">invers=True</span></code> return <code class="docutils literal notranslate"><span class="pre">sum</span> <span class="pre">f_i*i!*x**i</span></code></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_hadamard_exp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">+</span> <span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="mi">3</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_hadamard_exp</span><span class="p">(</span><span class="n">p</span><span class="p">)</span>
<span class="go">1/6*x**3 + 1/2*x**2 + x + 1</span>
</pre></div>
</div>
</dd></dl>

<p><strong>Operations</strong></p>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_mul">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_mul</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L212-L261"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_mul" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the product of the given two series, modulo <code class="docutils literal notranslate"><span class="pre">O(x**prec)</span></code>.</p>
<p><code class="docutils literal notranslate"><span class="pre">x</span></code> is the series variable or its position in the generators.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_mul</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p2</span> <span class="o">=</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_mul</span><span class="p">(</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">3*x**2 + 3*x + 1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_square">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_square</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L263-L301"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_square" title="Permalink to this definition">¶</a></dt>
<dd><p>Square the series modulo <code class="docutils literal notranslate"><span class="pre">O(x**prec)</span></code></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_square</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">x</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_square</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">6*x**2 + 4*x + 1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_pow">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_pow</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L303-L355"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_pow" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <code class="docutils literal notranslate"><span class="pre">p1**n</span></code> modulo <code class="docutils literal notranslate"><span class="pre">O(x**prec)</span></code></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_pow</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_pow</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">6*x**2 + 4*x + 1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_series_inversion">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_series_inversion</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L524-L560"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_series_inversion" title="Permalink to this definition">¶</a></dt>
<dd><p>Multivariate series inversion <code class="docutils literal notranslate"><span class="pre">1/p</span></code> modulo <code class="docutils literal notranslate"><span class="pre">O(x**prec)</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_series_inversion</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_series_inversion</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">-x**3*y**6 + x**2*y**4 - x*y**2 + 1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_series_inversion</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">-x*y**2 + 1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_series_inversion</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">x**3 - x**2 + x - 1 + x**(-1)</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_series_reversion">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_series_reversion</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">y</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L575-L645"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_series_reversion" title="Permalink to this definition">¶</a></dt>
<dd><p>Reversion of a series.</p>
<p><code class="docutils literal notranslate"><span class="pre">p</span></code> is a series with <code class="docutils literal notranslate"><span class="pre">O(x**n)</span></code> of the form <span class="math notranslate nohighlight">\(p = ax + f(x)\)</span>
where <span class="math notranslate nohighlight">\(a\)</span> is a number different from 0.</p>
<p><span class="math notranslate nohighlight">\(f(x) = \sum_{k=2}^{n-1} a_kx_k\)</span></p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>a_k</strong> : Can depend polynomially on other variables, not indicated.</p>
<blockquote>
<div><p>x : Variable with name x.
y : Variable with name y.</p>
</div></blockquote>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Solve <span class="math notranslate nohighlight">\(p = y\)</span>, that is, given <span class="math notranslate nohighlight">\(ax + f(x) - y = 0\)</span>,</p>
<p>find the solution <span class="math notranslate nohighlight">\(x = r(y)\)</span> up to <span class="math notranslate nohighlight">\(O(y^n)\)</span>.</p>
</dd>
</dl>
<p class="rubric">Algorithm</p>
<p>If <span class="math notranslate nohighlight">\(r_i\)</span> is the solution at order <span class="math notranslate nohighlight">\(i\)</span>, then:
<span class="math notranslate nohighlight">\(ar_i + f(r_i) - y = O\left(y^{i + 1}\right)\)</span></p>
<p>and if <span class="math notranslate nohighlight">\(r_{i + 1}\)</span> is the solution at order <span class="math notranslate nohighlight">\(i + 1\)</span>, then:
<span class="math notranslate nohighlight">\(ar_{i + 1} + f(r_{i + 1}) - y = O\left(y^{i + 2}\right)\)</span></p>
<p>We have, <span class="math notranslate nohighlight">\(r_{i + 1} = r_i + e\)</span>, such that,
<span class="math notranslate nohighlight">\(ae + f(r_i) = O\left(y^{i + 2}\right)\)</span>
or <span class="math notranslate nohighlight">\(e = -f(r_i)/a\)</span></p>
<p>So we use the recursion relation:
<span class="math notranslate nohighlight">\(r_{i + 1} = r_i - f(r_i)/a\)</span>
with the boundary condition: <span class="math notranslate nohighlight">\(r_1 = y\)</span></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_series_reversion</span><span class="p">,</span> <span class="n">rs_trunc</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y, a, b&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span> <span class="o">-</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">2</span><span class="o">*</span><span class="n">b</span><span class="o">*</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">a</span><span class="o">*</span><span class="n">b</span><span class="o">*</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p1</span> <span class="o">=</span> <span class="n">rs_series_reversion</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span> <span class="n">p1</span>
<span class="go">-2*y**2*a*b + 2*y**2*b + y**2 + y</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_trunc</span><span class="p">(</span><span class="n">p</span><span class="o">.</span><span class="n">compose</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">p1</span><span class="p">),</span> <span class="n">y</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">y</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_nth_root">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_nth_root</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L924-L998"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_nth_root" title="Permalink to this definition">¶</a></dt>
<dd><p>Multivariate series expansion of the nth root of <code class="docutils literal notranslate"><span class="pre">p</span></code>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>p</strong> : Expr</p>
<blockquote>
<div><p>The polynomial to computer the root of.</p>
</div></blockquote>
<p><strong>n</strong> : integer</p>
<blockquote>
<div><p>The order of the root to be computed.</p>
</div></blockquote>
<p><strong>x</strong> : <a class="reference internal" href="domainsref.html#sympy.polys.rings.PolyElement" title="sympy.polys.rings.PolyElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">PolyElement</span></code></a></p>
<p><strong>prec</strong> : integer</p>
<blockquote>
<div><p>Order of the expanded series.</p>
</div></blockquote>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The result of this function is dependent on the ring over which the
polynomial has been defined. If the answer involves a root of a constant,
make sure that the polynomial is over a real field. It can not yet handle
roots of symbols.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span><span class="p">,</span> <span class="n">RR</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_nth_root</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_nth_root</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="o">-</span><span class="mi">3</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">2/9*x**2*y**2 + 4/9*x**2*y + 2/9*x**2 - 1/3*x*y - 1/3*x + 1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">RR</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_nth_root</span><span class="p">(</span><span class="mi">3</span> <span class="o">+</span> <span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="go">0.160249952256379*x*y + 0.160249952256379*x + 1.44224957030741</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_trunc">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_trunc</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L96-L121"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_trunc" title="Permalink to this definition">¶</a></dt>
<dd><p>Truncate the series in the <code class="docutils literal notranslate"><span class="pre">x</span></code> variable with precision <code class="docutils literal notranslate"><span class="pre">prec</span></code>,
that is, modulo <code class="docutils literal notranslate"><span class="pre">O(x**prec)</span></code></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_trunc</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="mi">10</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="mi">5</span> <span class="o">+</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_trunc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>
<span class="go">x**10 + x**5 + x + 1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_trunc</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
<span class="go">x**5 + x + 1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_subs">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_subs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rules</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L357-L423"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_subs" title="Permalink to this definition">¶</a></dt>
<dd><p>Substitution with truncation according to the mapping in <code class="docutils literal notranslate"><span class="pre">rules</span></code>.</p>
<p>Return a series with precision <code class="docutils literal notranslate"><span class="pre">prec</span></code> in the generator <code class="docutils literal notranslate"><span class="pre">x</span></code></p>
<p>Note that substitutions are not done one after the other</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_subs</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">y</span><span class="o">**</span><span class="mi">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_subs</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="p">{</span><span class="n">x</span><span class="p">:</span> <span class="n">x</span><span class="o">+</span> <span class="n">y</span><span class="p">,</span> <span class="n">y</span><span class="p">:</span> <span class="n">x</span><span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">y</span><span class="p">},</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">2*x**2 + 6*x*y + 5*y**2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="n">y</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">y</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span>
<span class="go">2*x**2 + 6*x*y + 5*y**2</span>
</pre></div>
</div>
<p>which differs from</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">rs_subs</span><span class="p">(</span><span class="n">rs_subs</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="p">{</span><span class="n">x</span><span class="p">:</span> <span class="n">x</span><span class="o">+</span> <span class="n">y</span><span class="p">},</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="p">{</span><span class="n">y</span><span class="p">:</span> <span class="n">x</span><span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">y</span><span class="p">},</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go">5*x**2 + 12*x*y + 8*y**2</span>
</pre></div>
</div>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>p</strong> : <a class="reference internal" href="domainsref.html#sympy.polys.rings.PolyElement" title="sympy.polys.rings.PolyElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">PolyElement</span></code></a> Input series.</p>
<p><strong>rules</strong> : <code class="docutils literal notranslate"><span class="pre">dict</span></code> with substitution mappings.</p>
<p><strong>x</strong> : <a class="reference internal" href="domainsref.html#sympy.polys.rings.PolyElement" title="sympy.polys.rings.PolyElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">PolyElement</span></code></a> in which the series truncation is to be done.</p>
<p><strong>prec</strong> : <a class="reference internal" href="../core.html#sympy.core.numbers.Integer" title="sympy.core.numbers.Integer"><code class="xref py py-class docutils literal notranslate"><span class="pre">Integer</span></code></a> order of the series after truncation.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_subs</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_subs</span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="o">+</span><span class="n">y</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="p">{</span><span class="n">y</span><span class="p">:</span> <span class="p">(</span><span class="n">x</span><span class="o">+</span><span class="n">y</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">},</span> <span class="n">x</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="go"> 6*x**2*y**2 + x**2 + 4*x*y**3 + y**4</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_diff">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_diff</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L736-L766"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_diff" title="Permalink to this definition">¶</a></dt>
<dd><p>Return partial derivative of <code class="docutils literal notranslate"><span class="pre">p</span></code> with respect to <code class="docutils literal notranslate"><span class="pre">x</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>x</strong> : <a class="reference internal" href="domainsref.html#sympy.polys.rings.PolyElement" title="sympy.polys.rings.PolyElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">PolyElement</span></code></a> with respect to which <code class="docutils literal notranslate"><span class="pre">p</span></code> is differentiated.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_diff</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="o">*</span><span class="n">y</span><span class="o">**</span><span class="mi">3</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_diff</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="go">2*x*y**3 + 1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_integrate">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_integrate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L768-L798"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_integrate" title="Permalink to this definition">¶</a></dt>
<dd><p>Integrate <code class="docutils literal notranslate"><span class="pre">p</span></code> with respect to <code class="docutils literal notranslate"><span class="pre">x</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>x</strong> : <a class="reference internal" href="domainsref.html#sympy.polys.rings.PolyElement" title="sympy.polys.rings.PolyElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">PolyElement</span></code></a> with respect to which <code class="docutils literal notranslate"><span class="pre">p</span></code> is integrated.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_integrate</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="o">*</span><span class="n">y</span><span class="o">**</span><span class="mi">3</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_integrate</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="go">1/3*x**3*y**3 + 1/2*x**2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_newton">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_newton</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1750-L1770"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_newton" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute the truncated Newton sum of the polynomial <code class="docutils literal notranslate"><span class="pre">p</span></code></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_newton</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_newton</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
<span class="go">8*x**4 + 4*x**2 + 2</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_compose_add">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_compose_add</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p2</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L1802-L1850"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_compose_add" title="Permalink to this definition">¶</a></dt>
<dd><p>compute the composed sum <code class="docutils literal notranslate"><span class="pre">prod(p2(x</span> <span class="pre">-</span> <span class="pre">beta)</span> <span class="pre">for</span> <span class="pre">beta</span> <span class="pre">root</span> <span class="pre">of</span> <span class="pre">p1)</span></code></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_compose_add</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">g</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">-</span> <span class="mi">3</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_compose_add</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">g</span><span class="p">)</span>
<span class="go">x**4 - 10*x**2 + 1</span>
</pre></div>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r674"><span class="brackets"><a class="fn-backref" href="#id1">R674</a></span></dt>
<dd><p>A. Bostan, P. Flajolet, B. Salvy and E. Schost
“Fast Computation with Two Algebraic Numbers”,
(2002) Research Report 4579, Institut
National de Recherche en Informatique et en Automatique</p>
</dd>
</dl>
</dd></dl>

<p><strong>Utility functions</strong></p>
<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_is_puiseux">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_is_puiseux</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L123-L146"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_is_puiseux" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if <code class="docutils literal notranslate"><span class="pre">p</span></code> is Puiseux series in <code class="docutils literal notranslate"><span class="pre">x</span></code>.</p>
<p>Raise an exception if it has a negative power in <code class="docutils literal notranslate"><span class="pre">x</span></code>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_is_puiseux</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_is_puiseux</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_puiseux">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_puiseux</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L148-L185"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_puiseux" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the puiseux series for <span class="math notranslate nohighlight">\(f(p, x, prec)\)</span>.</p>
<p>To be used when function <code class="docutils literal notranslate"><span class="pre">f</span></code> is implemented only for regular series.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_puiseux</span><span class="p">,</span> <span class="n">rs_exp</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="n">x</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_puiseux</span><span class="p">(</span><span class="n">rs_exp</span><span class="p">,</span><span class="n">p</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">1/2*x**(4/5) + x**(2/3) + x**(2/5) + 1</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_puiseux2">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_puiseux2</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">q</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L187-L210"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_puiseux2" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the puiseux series for <span class="math notranslate nohighlight">\(f(p, q, x, prec)\)</span>.</p>
<p>To be used when function <code class="docutils literal notranslate"><span class="pre">f</span></code> is implemented only for regular series.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_series_from_list">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_series_from_list</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">c</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prec</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">concur</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L647-L734"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_series_from_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a series <span class="math notranslate nohighlight">\(sum c[n]*p**n\)</span> modulo <span class="math notranslate nohighlight">\(O(x**prec)\)</span>.</p>
<p>It reduces the number of multiplications by summing concurrently.</p>
<p><span class="math notranslate nohighlight">\(ax = [1, p, p**2, .., p**(J - 1)]\)</span>
<span class="math notranslate nohighlight">\(s = sum(c[i]*ax[i]\)</span> for i in <span class="math notranslate nohighlight">\(range(r, (r + 1)*J))*p**((K - 1)*J)\)</span>
with <span class="math notranslate nohighlight">\(K &gt;= (n + 1)/J\)</span></p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_series_from_list</span><span class="p">,</span> <span class="n">rs_trunc</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">c</span> <span class="o">=</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_series_from_list</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">6*x**3 + 11*x**2 + 8*x + 6</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_trunc</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="mi">2</span><span class="o">*</span><span class="n">p</span> <span class="o">+</span> <span class="mi">3</span><span class="o">*</span><span class="n">p</span><span class="o">**</span><span class="mi">2</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">6*x**3 + 11*x**2 + 8*x + 6</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pc</span> <span class="o">=</span> <span class="n">R</span><span class="o">.</span><span class="n">from_list</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="nb">reversed</span><span class="p">(</span><span class="n">c</span><span class="p">)))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_trunc</span><span class="p">(</span><span class="n">pc</span><span class="o">.</span><span class="n">compose</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">p</span><span class="p">),</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">6*x**3 + 11*x**2 + 8*x + 6</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.rs_fun">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">rs_fun</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">f</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L800-L854"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.rs_fun" title="Permalink to this definition">¶</a></dt>
<dd><p>Function of a multivariate series computed by substitution.</p>
<p>The case with f method name is used to compute <span class="math notranslate nohighlight">\(rs\_tan\)</span> and <span class="math notranslate nohighlight">\(rs\_nth\_root\)</span>
of a multivariate series:</p>
<blockquote>
<div><p><span class="math notranslate nohighlight">\(rs\_fun(p, tan, iv, prec)\)</span></p>
<p>tan series is first computed for a dummy variable _x,
i.e, <span class="math notranslate nohighlight">\(rs\_tan(\_x, iv, prec)\)</span>. Then we substitute _x with p to get the
desired series</p>
</div></blockquote>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>p</strong> : <a class="reference internal" href="domainsref.html#sympy.polys.rings.PolyElement" title="sympy.polys.rings.PolyElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">PolyElement</span></code></a> The multivariate series to be expanded.</p>
<p><strong>f</strong> : <span class="math notranslate nohighlight">\(ring\_series\)</span> function to be applied on <span class="math notranslate nohighlight">\(p\)</span>.</p>
<p><strong>args[-2]</strong> : <a class="reference internal" href="domainsref.html#sympy.polys.rings.PolyElement" title="sympy.polys.rings.PolyElement"><code class="xref py py-class docutils literal notranslate"><span class="pre">PolyElement</span></code></a> with respect to which, the series is to be expanded.</p>
<p><strong>args[-1]</strong> : Required order of the expanded series.</p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">rs_fun</span><span class="p">,</span> <span class="n">_tan1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">*</span><span class="n">y</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="o">*</span><span class="n">y</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="mi">3</span><span class="o">*</span><span class="n">y</span><span class="o">**</span><span class="mi">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">rs_fun</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">_tan1</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="go">1/3*x**3*y**3 + 2*x**3*y**2 + x**3*y + 1/3*x**3 + x**2*y + x*y + x</span>
</pre></div>
</div>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.mul_xin">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">mul_xin</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">i</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L856-L868"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.mul_xin" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <span class="math notranslate nohighlight">\(p*x_i**n\)</span>.</p>
<p><span class="math notranslate nohighlight">\(x\_i\)</span> is the ith variable in <code class="docutils literal notranslate"><span class="pre">p</span></code>.</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="sympy.polys.ring_series.pow_xin">
<span class="sig-prename descclassname"><span class="pre">sympy.polys.ring_series.</span></span><span class="sig-name descname"><span class="pre">pow_xin</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">p</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">i</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/sympy/sympy/blob/00d6469eafdd4aac346a0b598184c15f2560dbe5/sympy/polys/ring_series.py#L870-L887"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sympy.polys.ring_series.pow_xin" title="Permalink to this definition">¶</a></dt>
<dd><div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.domains</span> <span class="kn">import</span> <span class="n">QQ</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.rings</span> <span class="kn">import</span> <span class="n">ring</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sympy.polys.ring_series</span> <span class="kn">import</span> <span class="n">pow_xin</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">R</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ring</span><span class="p">(</span><span class="s1">&#39;x, y&#39;</span><span class="p">,</span> <span class="n">QQ</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">p</span> <span class="o">=</span> <span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">5</span><span class="p">)</span> <span class="o">+</span> <span class="n">x</span> <span class="o">+</span> <span class="n">x</span><span class="o">**</span><span class="n">QQ</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">index</span> <span class="o">=</span> <span class="n">p</span><span class="o">.</span><span class="n">ring</span><span class="o">.</span><span class="n">gens</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">pow_xin</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">index</span><span class="p">,</span> <span class="mi">15</span><span class="p">)</span>
<span class="go">x**15 + x**10 + x**6</span>
</pre></div>
</div>
</dd></dl>

</section>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../index.html">
              <img class="logo" src="../../_static/sympylogo.png" alt="Logo"/>
            </a></p>
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Series Manipulation using Polynomials</a><ul>
<li><a class="reference internal" href="#rs-series">rs_series</a></li>
<li><a class="reference internal" href="#contribute">Contribute</a><ul>
<li><a class="reference internal" href="#manipulation-of-power-series">Manipulation of power series</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="internals.html"
                        title="previous chapter">Internals of the Polynomial Manipulation Module</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="literature.html"
                        title="next chapter">Literature</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/modules/polys/ringseries.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://docs.sympy.org/latest/search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="literature.html" title="Literature"
             >next</a> |</li>
        <li class="right" >
          <a href="internals.html" title="Internals of the Polynomial Manipulation Module"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">SymPy 1.9 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >SymPy Modules Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" >Polynomial Manipulation</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="#">Series Manipulation using Polynomials</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2021 SymPy Development Team.
      Last updated on Sep 30, 2021.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
    </div>
  </body>

<!-- Mirrored from docs.sympy.org/latest/modules/polys/ringseries.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 15 Jan 2022 03:29:06 GMT -->
</html>